<?php

class MyModel extends aBaseModel {
	protected function formatFromDBData($table, $data)
	{
		return $data;
	}
	protected function formatToDBData($table, $data)
	{
		return $data;
	}
	protected function emptyDataWhenloadFromDB($table){
		return array();
	}
	protected function __construct( $userId , $lock = false ){
		$this->dbColumns = array(
			'user' => array(
				'name' , 'registtime' ,
			) ,
		);
		
		parent::__construct( $userId , 'user' , $lock );
	}
	
	private static $_singleoneObjects = array();
	
	public static function getInstance( $userId , $lock )
	{
		if( !isset( self::$_singleoneObjects[$userId] ) )
		{
			self::$_singleoneObjects[$userId] = new MyModel( $userId , $lock );
		}
		
		if( !self::$_singleoneObjects[$userId]->isLocked() )
		{
			self::$_singleoneObjects[$userId] = new MyModel( $userId , $lock );
		}
		
		if( $lock )
		{
			ObjectStorage::register( self::$_singleoneObjects[$userId] );
		}
		return self::$_singleoneObjects[$userId];
	}
	
	public function setRegisterTime( $time )
	{
		$this->data['registtime'] = $time;
		$this->updateToDb( 'user' ,  aBaseModel::DATA_ACTION_UPDATE , $this->data );
	}
	public function delete()
	{
		//$this->data['uid'] = intval($_GET['uId']);
		$this->updateToDb( 'user' , aBaseModel::DATA_ACTION_DELETE , $this->data );	
		
	}
}

?>